#pragma once
#include "host.h"

class AbstractState
{
public:
    AbstractState() = default;
    AbstractState(std::shared_ptr<std::shared_ptr<AbstractState>> currentStatePtr)
        :currentStatePtr(currentStatePtr) {}

    virtual int update() { return 1; }
    virtual void check_timeout() {}
    bool is_end() { return (*currentStatePtr)->isEndState;}

protected:
    template<class T>
    void trans_to() { *currentStatePtr = std::make_shared<T>(currentStatePtr); }

protected:
    bool isEndState = false;
    std::shared_ptr<std::shared_ptr<AbstractState>> currentStatePtr;
};

